import java.net.*;

public class ListenThread extends Thread {
	
	private MainWindow m_MainWindow;
	
	public ListenThread(MainWindow mainwindow)
	{
		this.m_MainWindow = mainwindow;
	}

	public void run() {
		int port = 5050;
		ServerSocket m_ServerSocket = null;
		Socket m_ClientSocket = null;
		try {
			m_ServerSocket = new ServerSocket(port);
			System.out.println("Server is listening on port "
					+ m_ServerSocket.getLocalPort());
			while (true) {
				m_ClientSocket = m_ServerSocket.accept();
				ConnectionThread connectionThread = new ConnectionThread(
						m_ClientSocket,m_MainWindow);
				connectionThread.start();
			}
		} catch (Exception e) {
			System.out.println(e);
		}
	}
}
